package Dao;

import com.alibaba.fastjson.JSON;
import daomian.Pcd;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import utils.JdbcTemplateUtil;

import java.util.List;

public class WebDaoImpl implements webDao {
    JdbcTemplate jdbcTemplate=new JdbcTemplate(JdbcTemplateUtil.getDataSource());
    @Override
    public String queryDao(int pid) {
        String sql="select * from pcd where pid=?";
        List<Pcd> query = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(Pcd.class), pid);
        String s = JSON.toJSONString(query);
        return s;
    }
}
